package exception;

public class TryCatchDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        try {
            String st = "0";
            System.out.println(st.length());
            System.out.println(st.charAt(1));
            System.out.println("!!!!!!!!");
        }catch (NullPointerException|StringIndexOutOfBoundsException e){
            System.out.println("出现了空指针或下标越界异常");
        }catch (Exception b){
            System.out.println("程序出错了");
        }
//        }catch (NullPointerException e){
//            System.out.println("解决异常");
//        }catch (StringIndexOutOfBoundsException c){
//            System.out.println("下标越界异常" );
//        }
        System.out.println("程序结束");
    }
}
